const {
    Rule,
    LinValidator
  } = require('../../core/lin-validator-v2')
  
  class registValidator extends LinValidator {
    constructor() {
      super()
  
      this.is_student = [
        new Rule("isLength", "身份 不能为空", {min: 1})
      ]
      this.mail = [
        new Rule("isLength", "邮箱 不能为空", {min: 1})
      ]
      this.nickname = [
        new Rule("isLength", "昵称 不能为空", {min: 1})
      ]
      this.pwd = [
        new Rule("isLength", "密码 不能为空", {min: 1})
      ]
    }
  }
  class loginValidator extends LinValidator {
    constructor() {
      super()
  
      this.account = [
        new Rule("isLength", "账号 不能为空", {min: 1})
      ]
      this.pwd = [
        // 用户密码指定范围
        new Rule('isLength', '密码至少6个字符，最多22个字符', {
          min: 6,
          max: 22
        }),
      ]
    }
  }
  
  class PositiveUserIdParamsValidator extends LinValidator {
    constructor() {
      super();
      this.id = [
        new Rule('isInt', '用户ID需要正整数', {min: 1})
      ]
    }
  }
  
  module.exports = {
    registValidator,
    PositiveUserIdParamsValidator,
    loginValidator
  }
  